package ch4;

/**
 * @author ANG.YU
 * @date 2020-08-09 13:30
 */
public class Overloading {
    public static void main(String[] args) {
        for (int i = 0; i < 5; i++) {
            Tree t = new Tree(i);
            t.info();
            t.info("overloaded method");
        }
        new Tree();
    }
}

class Tree {
    int height;

    public Tree() {
        prt("Planting a seedling");
        height = 0;

    }

    Tree(int i) {

        prt("Creating new Tree that is "
                + i + " feet tall");
        height = i;
    }

    static void prt(String s) {
        System.out.println(s);
    }

    void info() {
        prt("Tree is " + height
                + " feet tall");
    }

    void info(String s) {
        prt(s + ": Tree is "
                + height + " feet tall");
    }

}